package com.dongdongshop.service.imp;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbItemMapper;
import com.dongdongshop.pojo.TbItem;
import com.dongdongshop.pojo.TbItemExample;
import com.dongdongshop.service.ItemService;
import com.dongdongshop.service.TbItemCatSerive;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class ItemServiceImp implements ItemService {

    @Autowired
    private TbItemMapper tbItemMapper;

    @Override
    public List<TbItem> selectItemById(Long goodsId) {
        TbItemExample tbItemExample = new TbItemExample();
        tbItemExample.createCriteria().andGoodsIdEqualTo(goodsId);
        tbItemExample.createCriteria().andStatusEqualTo("1");
        tbItemExample.createCriteria().andStockCountGreaterThan(0);
        return tbItemMapper.selectByExample(tbItemExample);
    }

    @Override
    public TbItem getItemId(Long itemId) {

        return tbItemMapper.selectByPrimaryKey(itemId);
    }
}
